* Issue COMMIT only on master, only if queries were done on connection
*/
public function commitMasterChanges() {
- // Always 0, but who knows.. :)
$masterIndex = $this->getWriterIndex();
foreach ( $this->mConns as $conns2 ) {
if ( empty( $conns2[$masterIndex] ) ) {
* @since 1.23
*/
public function rollbackMasterChanges() {
- // Always 0, but who knows.. :)
+ $failedServers = array();
+
$masterIndex = $this->getWriterIndex();
foreach ( $this->mConns as $conns2 ) {
if ( empty( $conns2[$masterIndex] ) ) {
/** @var DatabaseBase $conn */
foreach ( $conns2[$masterIndex] as $conn ) {
if ( $conn->trxLevel() && $conn->writesOrCallbacksPending() ) {
- $conn->rollback( __METHOD__, 'flush' );
+ try {
+ $conn->rollback( __METHOD__, 'flush' );
+ } catch ( DBError $e ) {
+ MWExceptionHandler::logException( $e );
+ $failedServers[] = $conn->getServer();
+ }
}
}
}
+
+ if ( $failedServers ) {
+ throw new DBExpectedError( null, "Rollback failed on server(s) " .
+ implode( ', ', array_unique( $failedServers ) ) );
+ }
}
/**
* @return bool
*/
public function hasMasterChanges() {
- // Always 0, but who knows.. :)
$masterIndex = $this->getWriterIndex();
foreach ( $this->mConns as $conns2 ) {
if ( empty( $conns2[$masterIndex] ) ) {
*/
public function lastMasterChangeTimestamp() {
$lastTime = false;
- // Always 0, but who knows.. :)
$masterIndex = $this->getWriterIndex();
foreach ( $this->mConns as $conns2 ) {
if ( empty( $conns2[$masterIndex] ) ) {